package com.tedu.openmedical.btAuditor.controller;


import com.tedu.openmedical.base.response.JsonResult;
import com.tedu.openmedical.binfopatientinfo.pojo.entity.BinfoPatientInfo;
import com.tedu.openmedical.binfopatientinfo.service.BinfoPatientInfoService;
import com.tedu.openmedical.brregister.pojo.dto.AddRegister;
import com.tedu.openmedical.brregister.pojo.entity.BrRegister;
import com.tedu.openmedical.btAuditor.pojo.BtAuditor;
import com.tedu.openmedical.btAuditor.pojo.vo.AuditorSelectAllVo;
import com.tedu.openmedical.btAuditor.pojo.vo.AuditorSelectOneVo;
import com.tedu.openmedical.btAuditor.service.BtAuditorService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

import static jdk.nashorn.internal.runtime.regexp.joni.Config.log;

/**
 * <p>
 * 病案借阅审核表 前端控制器
 * </p>
 *
 * @author testjava
 * @since 2024-08-11
 */
@RestController
@RequestMapping("/bt/Auditor")
@Slf4j
@CrossOrigin
public class BtAuditorController {
    @Autowired
    private BtAuditorService btAuditorService;
    //selectRegisterAll:查询所有病案借阅登记表
    @GetMapping("/select/selectAll")
    public JsonResult selectAll(){
        List<AuditorSelectAllVo> auditorDataAll = btAuditorService.selectAll();
        return JsonResult.ok(auditorDataAll);
    }
    //selectOne：根据审核id查询
    @GetMapping("/select/selectOne/{id}")
    public JsonResult selectOne(@PathVariable String id){
        AuditorSelectOneVo auditorDataOne  = btAuditorService.selectOne(id);
        return JsonResult.ok(auditorDataOne);
    }
    //updateStatusPass：更新审核状态:通过
    @PutMapping("/update/updateStatusPass/{id}")
    public JsonResult updateStatusPass(@PathVariable String id){
        btAuditorService.updateStatusPass(id);
        return JsonResult.ok();
    }
    //updateStatusPass：更新审核状态:驳回
    @PutMapping("/update/updateStatusReject/{id}/{rejectReason}")
    public JsonResult updateStatusReject(@PathVariable String id,@PathVariable String rejectReason){
        btAuditorService.updateStatusReject(id,rejectReason);
        return JsonResult.ok();
    }

    @PutMapping("/update/updateStatusCancel/{id}")
    public JsonResult updateStatusCancel(@PathVariable String id){
        btAuditorService.updateStatusCancel(id);
        return JsonResult.ok();
    }
}

